<?php
define ("DB_HOST", "localhost");
define ("DB_NAME", "zimam2");
define ("DB_USER", "zimam2");
define ("DB_PASSWD", "zimam2_passwd");

function db_connect(){
        $link = mysqli_connect(DB_HOST, DB_USER, DB_PASSWD);
        if (!$link) {
            echo ("Nepodařilo se spojit s DB.<br>");
            echo (mysqli_connect_error());
            exit();
        } else {
            $success = mysqli_select_db($link, DB_NAME);
            if (!$success) {
                echo ("Nepodařilo se přepnout na správnou databázi");
                exit();
            } else {
                $set = mysqli_query($link, "SET NAMES utf8");
                return $link;
            }
        }
}
function db_close($link){
    return mysqli_close($link);
}

?>
